/**
 * 
 */
package evolution.tutors;

import java.util.LinkedList;

/**
 * @author camille
 * 
 */
public class TutorFactory {
	private static TutorFactory singleton;

	private TutorFactory() {
		// nothing...
	}

	public static TutorFactory getInstance() {
		if (singleton == null) {
			singleton = new TutorFactory();
		}

		return singleton;
	}

	public LinkedList<Tutor> getAllTutors() {
		LinkedList<Tutor> tutors = new LinkedList<Tutor>();

		tutors.add(RobotTutor.getInstance());
		tutors.add(AND.getInstance());
		tutors.add(OR.getInstance());
		tutors.add(XOR.getInstance());

		return tutors;
	}

	public Tutor getTutor(String name) {

		if (name.equals(RobotTutor.getInstance().getName())) {
			return RobotTutor.getInstance();
		}

		if (name.equals(AND.getInstance().getName())) {
			return AND.getInstance();
		}

		if (name.equals(OR.getInstance().getName())) {
			return OR.getInstance();
		}

		if (name.equals(XOR.getInstance().getName())) {
			return XOR.getInstance();
		}

		return null;
	}
}
